#ifndef __INCUserInfoh
#define __INCUserInfoh
#include <string>

// Authentication stage enumeration (using bit-shifted values for potential bitmask operations)
// Each stage represents a state in the user login authentication process
enum AuthStage
{
    AUTH_INIT = SHIFT_BIT(0),      // Initialization stage: Authentication starts, ready to accept user input
    AUTH_WAIT_USER = SHIFT_BIT(1), // Waiting for username stage: Prompt user to enter username, waiting for input
    AUTH_WAIT_PASS = SHIFT_BIT(2), // Waiting for password stage: Username received, prompt for password, waiting for input
    AUTH_SUCCESS = SHIFT_BIT(3),   // Authentication success stage: Username and password verified, login successful
    AUTH_FAILED = SHIFT_BIT(4)     // Authentication failed stage: Verification failed (invalid username/password/locked account etc.)
};

// 假设 SHIFT_BIT 是自定义移位宏，例如 #define SHIFT_BIT(n) (1 << (n))
enum UserPermission
{
    BANNED = SHIFT_BIT(0),     // Banned: Forbidden to access any system functions
    GUEST = SHIFT_BIT(1),      // Guest: Read-only access to basic functions only
    OPERATOR = SHIFT_BIT(2),   // Operator: Can perform regular operations (e.g., data query, simple modifications)
    ADMIN = SHIFT_BIT(3),      // Admin: Can manage users and configure basic parameters
    SUPER_ADMIN = SHIFT_BIT(4) // Super Admin: Full privileges (including system-level configuration and permission assignment)
};

// User information structure (permission field changed to enum for type safety)
struct UserInfo
{
    std::string username;      // Unique username (unique identifier)
    std::string password;  // SHA-256 hash of the password (no plaintext storage)
    UserPermission permission; // Permission level (enum type to avoid string typos)
};
namespace UserConstants 
{
    // Default super administrator username (constexpr compile-time constant for higher efficiency)
    constexpr const char* DEFAULT_SUPER_ADMIN_USERNAME = "admin";

    // Default initial password (for production environment, encrypted storage is recommended; only the initial value is stored here)
    constexpr const char* DEFAULT_SUPER_ADMIN_PASSWORD = "Changeme123";

    // Permission directly bound to enum, ensuring type safety (no string conversion risks)
    constexpr UserPermission DEFAULT_SUPER_ADMIN_PERMISSION = UserPermission::SUPER_ADMIN;
}
#endif
